home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Text⁄Files
/
File List 14
/
Stack.c
< prev
next >
Wrap
Text File
|
1990-09-14
|
432b
|
29 lines
/*
FileList 1.4
"Stack.c"
*/
#include "Stack.h"
void InitStack (register STACK *s)
{
s->pointer = s->max = (STACKELEMENT *)&(s->stack) + STACKSIZE;
}
short PushStack (
register STACK *s,
STACKELEMENT x)
{
if (s->pointer <= (STACKELEMENT *)&(s->stack))
return 0;
*(--(s->pointer)) = x;
return 1;
}
STACKELEMENT PopStack (register STACK *s)
{
if (s->pointer >= s->max)
return STACKERROR;
return *((s->pointer)++);
}